Getting Our Data Ready

Column 1

Getting Data

library(rscorecard)
library(rstudioapi)
library(knitr)

# Key registration https://collegescorecard.ed.gov/data/documentation/
my_key <- askForPassword()
sc_key(my_key)


# Population predominantly bachelor's-degree granting colleges (preddeg==3)
df <- sc_init() %>% 
  sc_filter(preddeg==3) %>%
  sc_select(unitid, instnm, stabbr, city, actcm25, actcm75, ugds, control, distanceonly,
            md_earn_wne_p6, md_earn_wne_p8, md_earn_wne_p10,
            npt4_pub,npt4_priv, 
            omawdp8_ftft, 
            latitude,longitude) %>%
  sc_year('latest') %>% 
  sc_get()

# Exclusions 
# (1) Not online only (DISTANCEONLY == 0)
# (2) College in US state (exclude DC and US territories)

excluded_strabbr <- unique(df$stabbr[!df$stabbr %in% state.abb])
df <- df[df$stabbr %in% state.abb,]
df <- df[df$distanceonly == 0,]
save(df,"your file path")

Column 2

Our Data Sample

load('college.Rda')
knitr::kable(head(df, n=8))
unitid instnm stabbr city actcm25 actcm75 ugds control distanceonly md_earn_wne_p6 md_earn_wne_p8 md_earn_wne_p10 npt4_pub npt4_priv omawdp8_ftft latitude longitude year
100654 Alabama A & M University AL Normal 15 19 5271 1 0 25200 27100 31000 14990 NA 0.2725 34.78337 -86.56850 latest
100663 University of Alabama at Birmingham AL Birmingham 22 29 13328 1 0 35100 38300 41200 16953 NA 0.5599 33.50570 -86.79935 latest
100706 University of Alabama in Huntsville AL Huntsville 25 31 7785 1 0 36200 41800 46700 15860 NA 0.5488 34.72456 -86.64045 latest
100724 Alabama State University AL Montgomery 15 19 3750 1 0 22600 25200 27700 13650 NA 0.3103 32.36432 -86.29568 latest
100751 The University of Alabama AL Tuscaloosa 23 31 31900 1 0 37400 40300 44500 22597 NA 0.6957 33.21187 -87.54598 latest
100812 Athens State University AL Athens NA NA 2677 1 0 33400 37500 38700 NA NA NA 34.80679 -86.96470 latest
100830 Auburn University at Montgomery AL Montgomery 19 23 4407 1 0 30100 33500 33300 13987 NA 0.3018 32.36736 -86.17754 latest
100858 Auburn University AL Auburn 25 31 24209 1 0 39500 44900 48800 24104 NA 0.7876 32.59938 -85.48826 latest
dim(df)
[1] 1945   18

College Tuition

Setup

Questions

Answers